package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AccountingBookSettingsMapper;
import com.ruoyi.system.domain.AccountingBookSettings;
import com.ruoyi.system.service.IAccountingBookSettingsService;

/**
 * 记账本设置 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-13
 */
@Service
public class AccountingBookSettingsServiceImpl implements IAccountingBookSettingsService
{
    @Autowired
    private AccountingBookSettingsMapper accountingBookSettingsMapper;

    /**
     * 通过id查询记账本设置
     *
     * @param id 记账本设置主键
     * @return 记账本设置信息
     */
    @Override
    public AccountingBookSettings selectAccountingBookSettingsById(Long id)
    {
        return accountingBookSettingsMapper.selectAccountingBookSettingsById(id);
    }

    /**
     * 查询记账本设置列表
     *
     * @param storeName 门店名称信息
     * @return 记账本设置信息
     */
    @Override
    public List<AccountingBookSettings> selectAccountingBookSettingsListByName(String storeName)
    {
        return accountingBookSettingsMapper.selectAccountingBookSettingsListByName(storeName);
    }

    /**
     * 新增记账本设置
     *
     * @param accountingBookSettings 记账本设置
     * @return 结果
     */
    @Override
    public int insertAccountingBookSettings(AccountingBookSettings accountingBookSettings)
    {
        accountingBookSettings.setCreateTime(DateUtils.getNowDate());
        return accountingBookSettingsMapper.insertAccountingBookSettings(accountingBookSettings);
    }

    /**
     * 修改记账本设置
     *
     * @param accountingBookSettings 记账本设置信息
     * @return 结果
     */
    @Override
    public int updateAccountingBookSettings(AccountingBookSettings accountingBookSettings)
    {
        accountingBookSettings.setUpdateTime(DateUtils.getNowDate());
        return accountingBookSettingsMapper.updateAccountingBookSettings(accountingBookSettings);
    }

    /**
     * 通过id批量删除记账本设置信息
     *
     * @param ids 需要删除的记账本设置主键
     * @return 结果
     */
    @Override
    public int deleteAccountingBookSettingsByIds(Long[] ids)
    {
        return accountingBookSettingsMapper.deleteAccountingBookSettingsByIds(ids);
    }

    /**
     * 通过id删除记账本设置信息
     *
     * @param id 记账本设置信息主键
     * @return 结果
     */
    @Override
    public int deleteAccountingBookSettingsById(Long id)
    {
        return accountingBookSettingsMapper.deleteAccountingBookSettingsById(id);
    }
}
